//
//  ByDocumentaryUserListCell.m
//  caipiao_ios
//
//  Created by mc on 2018/8/10.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByDocumentaryUserListCell.h"

@implementation ByDocumentaryUserListCell

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByDocumentaryUserListCell";
    ByDocumentaryUserListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        self.contentView.backgroundColor = BY_BACKGROUND_COLOR;
        [self initViews];
    }
    return self;
}


- (void)initViews{
    
    [self.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    UIView *backgroundView = [[UIView alloc] init];
    [self.contentView addSubview:backgroundView];
    [backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(8);
        make.right.equalTo(self.contentView).offset(-8);
        make.bottom.equalTo(self.contentView).offset(-1);
        make.top.equalTo(self.contentView).offset(0);
    }];
    backgroundView.backgroundColor = [UIColor whiteColor];
    backgroundView.layer.cornerRadius = 5;
    
    
    UILabel *timeLabel = [[UILabel alloc] init];
    [backgroundView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(backgroundView).offset(-10);
        make.height.mas_equalTo(@15);
        make.width.mas_equalTo(@200);
        make.top.equalTo(self.contentView).offset(13);
    }];
    timeLabel.textColor = [UIColor lightGrayColor];
    timeLabel.font = FONT(12);
    timeLabel.text = @"2018-06-26 10:50:00";
    timeLabel.textAlignment = NSTextAlignmentRight;
    
    
    UILabel *titleLabel = [[UILabel alloc] init];
    [backgroundView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(18);
        make.top.equalTo(backgroundView).offset(10);
        make.height.mas_equalTo(@15);
        make.width.mas_equalTo(@70);
    }];
    titleLabel.font = FONT(14);
    titleLabel.textColor = BY_TEXT_COLOR;
    titleLabel.text = @"竞彩足球";
    
    
    UILabel *moneyLabel = [[UILabel alloc] init];
    [backgroundView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel.mas_left).offset(0);
        make.centerY.equalTo(backgroundView).offset(0);
        make.right.equalTo(backgroundView).offset(-10);
        make.height.mas_equalTo(@15);
    }];
    moneyLabel.font = FONT(12);
    moneyLabel.text = @"2元起投";
    moneyLabel.textColor = [UIColor lightGrayColor];
    
    
    UILabel *notesLabel = [[UILabel alloc] init];
    [backgroundView addSubview:notesLabel];
    [notesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel.mas_left).offset(0);
        make.bottom.equalTo(backgroundView).offset(-17);
        make.width.mas_equalTo(@120);
        make.height.mas_equalTo(@15);
    }];
    notesLabel.font = FONT(14);
    notesLabel.text = @"自购：100元";
    notesLabel.textColor = [UIColor blackColor];
    
    
    UILabel *personLabel = [[UILabel alloc] init];
    [backgroundView addSubview:personLabel];
    [personLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(notesLabel.mas_right).offset(10);
        make.bottom.equalTo(backgroundView).offset(-17);
        make.width.mas_equalTo(@120);
        make.height.mas_equalTo(@15);
    }];
    personLabel.font = FONT(14);
    personLabel.text = @"跟单：10人";
    personLabel.textColor = [UIColor blackColor];
    
}

@end
